package com.dlq.cloud.controller;

import com.dlq.cloud.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class LoginConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    private static final String Rest_URL_PREFIX = "http://localhost:8001";

    @RequestMapping(value="/consumer/{userName}")
    public User getUserByName(@PathVariable(value="userName") String userName){
        System.out.println(userName);
        return restTemplate.getForObject(Rest_URL_PREFIX+"/user/"+userName,User.class);
    }



}
